<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        #box {
            margin: 20px auto;
            width: 100px;
            height: 100px;
            background: red;
        }

        #outer {
            position: relative;
            top: 30px;
            left: 30px;
            width: 200px;
            height: 200px;
            background: red;
            cursor: pointer;
        }

        #inner {
            position: absolute;
            top: 30px;
            left: 30px;
            width: 100px;
            height: 100px;
            background: green;
            cursor: pointer;
        }
    </style>
</head>

<body>
    <div id="outer">
        <div id="inner"></div>
    </div>
    <script>
        let inner=document.getElementById('inner')
        let outer=document.getElementById('outer')
        inner.onmouseenter = function () {
            console.log('inner enter');
        };
        outer.onmouseenter = function (){
           
            console.log('outer enter');
        };
        inner.onmouseleave = function () {
            console.log('inner leave');
        };
        outer.onmouseleave = function () {
            console.log('outer leave');
        };



        // inner.onmouseover = function () {
        //     console.log('inner enter');
        // };
        // outer.onmouseover = function (e){
        //     console.log(e.target)
        //     console.log('outer enter');
        // };
        // inner.onmouseout = function () {
        //     console.log('inner leave');
        // };
        // outer.onmouseout = function () {
        //     console.log('outer leave');
        // };
    </script>
</body>

</html>